<?php
header("Content-Type:text/html;charset=utf-8");

$filename = array("aba6aa0208aaf918e0395fce0693ec11_eiziaCube.js",
				  "aba6aa0208aaf918e0395fce0693ec11_picker.js",
				  "aba6aa0208aaf918e0395fce0693ec11_view.js",
				  "aba6aa0208aaf918e0395fce0693ec11_backGround.js",
				  "aba6aa0208aaf918e0395fce0693ec11_menu.js",
				  "aba6aa0208aaf918e0395fce0693ec11_worker.js",
				  "aba6aa0208aaf918e0395fce0693ec11_listen.js",
				  "aba6aa0208aaf918e0395fce0693ec11_dialog.js",
				  "aba6aa0208aaf918e0395fce0693ec11_dialog_kids.js",
				  "aba6aa0208aaf918e0395fce0693ec11_dialog_wov.js",
				  "aba6aa0208aaf918e0395fce0693ec11_creator.js");
$contents = array();
$handle = array();
//依次打开读取到不同的contents数组里
for($n=0;$n<count($filename);$n++){
	$handle[$n] = fopen($filename[$n], "r");
	$contents[$n] = fread($handle[$n], filesize($filename[$n]));
	fclose($handle[$n]);
	}
	
	
	for($n=0;$n<count($filename);$n++){
		//移除所有注释
		$contents[$n] = preg_replace("/\/\/[^\n]*|\/\*([^\*^\/]*|[\*^\/*]*|[^\**\/]*)*\*\//","",$contents[$n]);
		$changeString = array("o3dElement",
							  "cubeClient",
							  "menuClient",
							  "cubeO3d",
							  "cubePack",
							  "o3dMath",
							  "viewInfo",
							  "menuViewInfo",
							  "backViewInfo",
							  "cubeMass",
							  "menuMass",
							  "moveTime",
							  "acceleraTime",
							  "frameMoveTime",
							  "frameAlphaTime",
							  "mouseCursor",
							  "mouseAmong",
							  "customizeCursor",
							  "cubeDragging",
							  "dragFrame",
							  "zBuffer",
							  "initCreateCube",
							  "initTexture",
							  "afterTextureLoaded",
							  "_cubePickDistance",
							  "initData",
							  "_menuOrder",
							  "_scaleEffect",
							  "_moveEffect",
							  "_sortZindexByDis",
							  "changeOtherAlpha",
							  "changeAlpha",
							  "findCubeNum",
							  "direction",
							  "bulidNumber",
							  "o3dElement",
							  "cubeClient",
							  "menuClient",
							  "cubeO3d",
							  "cubePack",
							  "o3dMath",
							  "viewInfo",
							  "menuViewInfo",
							  "backViewInfo",
							  "cubeMass",
							  "menuMass",
							  "menuMassData",
							  "backImage",
							  "shape",
							  "eyeMoveDelta",
							  "eyeOri",
							  "eyePosi",
							  "eyeAngle",
							  "eyeR",
							  "viewCenter",
							  "eyeTarAmong",
							  "zoomFactor",
							  "moveFactor",
							  "mouseButton",
							  "mouseMode",
							  "defultValue",
							  "colorOftenUse",
							  "cubeSelect",
							  "cubeSelectNow",
							  "frameActiveNow",
							  "menuSelect",
							  "moveArrow",
							  "growthArrow",
							  "cubeCoordArray",
							  "growthBounding",
							  "touchPicked",
							  "deltaCubesKey",
							  "freezeSelectNow",
							  "freezeSelectMatrix",
							  "drawCubePlan",
							  "menuMaterial",
							  "backMaterial",
							  "createCubeCoordArray",
							  "picker",
							  "pick",
							  "virtualPick",
							  "cubePick",
							  "touchPickedFace",
							  "initDrawPlan",
							  "drawSelectCube",
							  "drawColorToCube",
							  "getColorByPick",
							  "mass",
							  "moveViewCenter",
							  "angleRotate",
							  "zoomEyeR",
							  "maxMinCoordinate",
							  "resetView",
							  "resetCentreBySele",
							  "resetCentre",
							  "changeView",
							  "backGround",
							  "createTexture",
							  "frame",
							  "menuMassLevelArray",
							  "menuFunction",
							  "changeCube",
							  "menuEdit",
							  "colorPen",
							  "menu",
							  "createMenuMassBy",
							  "createByArray",
							  "active",
							  "formatAlpha",
							  "newOne",
							  "worker",
							  "save",
							  "create",
							  "_justCreate",
							  "createACubeByString",
							  "capture",
							  "removeCubesXYZ",
							  "clearNochildParentByNotUpBounding",
							  "clearNochildParent",
							  "removeCubes",
							  "removeAllCubes",
							  "reComputeBounding",
							  "reAddBoundingByChild",
							  "selectAllExist",
							  "packCube",
							  "_packCubeAt",
							  "unPackCube",
							  "_unPackCubeAt",
							  "buttPlaneBunding",
							  "openCloseMoveMode",
							  "listen",
							  "editMass",
							  "dialog",
							  "splitTextBy",
							  "_splitTextNext",
							  "changeBgImageTexture",
							  "changeBgColor",
							  "changeScale",
							  "moveTo",
							  "changeFrameAlpha",
							  "changeTextAlpha",
							  "changeImageAlpha",
							  "changeText",
							  "moveTextTo",
							  "addFrame",
							  "subFromParent",
							  "allActiveLeave",
							  "checkMouseDown",
							  "checkMouseOver",
							  "checkMouseUp",
							  "checkMouseDrag",
							  "activeChildByName",
							  "dragByMouse",
							  "loseActive",
							  "getActive",
							  "getChildByName",
							  "moveDialogTo",
							  "removeDialog",
							  "alphaShow",
							  "createASection",
							  "converArrayToDialog",
							  "createAButton",
							  "createAColorPlan",
							  "createAColorLine",
							  "createAPureColorPlan",
							  "createADragBar",
							  "create_SetColor",
							  "addNewActiveNow",
							  "addActiveNowBy",
							  "delActiveNow",
							  "checkActiveNum",
							  "colorCustomize",
							  "colorPreload",
							  "colorSelect",
							  "totalColorUnitFrame",
							  "chooseColorFrame",
							  "colorLibraryStart",
							  "colorFrameMoveTime",
							  "colorLibraryArrayNo",
							  "colorLibraryArray",
							  "createColorExample",
							  "colorComparison",
							  "createColorGlobal",
							  "createColorBlock",
							  "createColorLibrary",
							  "createColorOftenFrame",
							  "createColorUnitTitle",
							  "createJoinButtonCustomize",
							  "createTotalColorUnit",
							  "chooseColorBlock",
							  "chooseColorUnit",
							  "chooseColor",
							  "moveDialogByDirection",
							  "_moveDialogSteps",
							  "subFrameByName",
							  "findFrameByName",
							  "findTheTopParent",
							  "createcustomizeCursor",
							  "freezeSelect",
							  "freezeMatrix",
							  "freezeMatrixCubeAndMass",
							  "clearCoorArray",
							  "cubeMove",
							  "_moveSelectMass",
							  "upDateMovedInfo",
							  "cubeGrowth",
							  "insertCubeOri",
							  "insertSelectCube",
							  "deleUnGrowth",
							  "_bulidCube",
							  "_hideSubCube",
							  "_showSubCube",
							  "_shiftSelect",
							  "addFrames",
							  "copyFramesMass",
							  "_addPlan",
							  "removeAllFrames",
							  "frameLine",
							  "framePlan",
							  "copyCube",
							  "creator",
							  "changeColor",
							  "oriCube",
							  "_findFarCube",
							  "flashFramesTime",
							  "flashFramesNesting",
							  "sortUp",
							  "sortDown",
							  "pickInfo",
							  "_moveSmooth",
							  "_zoomSmooth",
							  "eyeAfter",
							  "tStep",
							  "eyeBefore",
							  "_changeEye",
							  "bgImage",
							  "bgColor",
							  "activation",
							  "z_index",
							  "bgImageWidth",
							  "bgImageHeight",
							  "bgImageTextureAlpha",
							  "bgDirection",
							  "bgWidth",
							  "bgHeight",
							  "limitWidth",
							  "scaleTransform",
							  "bgImageMoveTransform",
							  "menuReviewUp",
							  "menuReviewDown",
							  "menuReviewLeft",
							  "menuReviewRight",
							  "menuClearSelected",
							  "menuMassDataCon",
							  "updataAllLight",
							  "updataLight",
							  "_changeSubCube",
							  "selectCubeByXYZ",
							  "scrollCubes",
							  "_displayArrowByPick",
							  "certainAction",
							  "cancelAction",
							  "upDataBoundingTree",
							  "coupleArrow",
							  "moveByPick",
							  "displayByPick"
							 	);
	for($m=0;$m<count($changeString);$m++){
		$pregChangeString[$m] = "/\b".$changeString[$m]."\b/";
		$contents[$n] = preg_replace($pregChangeString[$m],"e".$m,$contents[$n]);
		}
	}
	
//合并并生成文件到o3dAll.js这个文件里
$mixJsHandle=fopen("o3dAll.js","w");
for($n=0;$n<count($filename);$n++){
	fwrite($mixJsHandle,$contents[$n]);
	}
fclose($mixJsHandle);

$varListHandle=fopen("aba6aa0208aaf918e0395fce0693ec11_var.html","w");
	fwrite($varListHandle,"<table border='1' style='font-size:12px;'><tbody>");
for($l=0;$l<count($changeString);$l++){
	$writeString = "<tr><td>".$changeString[$l]."</td><td> e".$l."</td>";
	fwrite($varListHandle,$writeString);
	}
	fwrite($varListHandle,"</tbody></table>");
fclose($varListHandle);
?>